// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import Vant from 'vant'
import {Toast} from 'vant';
import api from './api/index.js'


//引入组件样式文件
import 'vant/lib/index.css';
//注册组件库
Vue.use(Vant);

// 设置轻提示框的展示时长
Toast.setDefaultOptions({
  duration: 1000
})

//路由守卫
router.beforeEach((to, from, next) => {
  next()
  // const pagesNeedAuth=['/profile','/editprofile']

  // if (pagesNeedAuth.includes(to.path)) {
  //   localStorage.getItem('token') ? next() : router.push({name: 'login'});
  // }else{
  //   next();
  // }
})

Vue.prototype.$axios = axios;
Vue.prototype.$api = api;
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {
    App
  },
  template: '<App/>'
})
